package com.jingdianjichi.subject.domain.job;

import com.jingdianjichi.subject.domain.service.SubjectLikedDomainService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 同步点赞数据的任务
 */
@Component
@Slf4j
public class SyncLikedJob {

    @Resource
    private SubjectLikedDomainService likedDomainService;

    /**
     * 同步点赞数据任务
     */
    @XxlJob("lsl")
    public void syncLikedJobHandler()throws Exception{
        //他的日志可以在图像化 界面中打印出来信息的
        log.info("syncLikedJobHandler.start");

        try {
            //同步数据
            likedDomainService.syncLiked();

            log.error("任务调度成功了亲");
        }catch (Exception e){
            log.info("syncLikedJobHandler.error:{}",e,e.getMessage());
        }
    }
}
